package nrpc.client.serst;

import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.function.Consumer;

/**
 * 手动配置服务
 */
public class ConfiguredServiceStrategy implements ServiceStrategy {

	private List<ServiceNode> services = new ArrayList<>();
	
	public ConfiguredServiceStrategy(InetSocketAddress...addresses) {
		for(InetSocketAddress x: addresses) {
			services.add(new AddressServiceNode(x));
		}
	}
	
	@Override
	public void subscribe(Consumer<? super ServiceNode> add, Consumer<? super ServiceNode> delete) {
		services.forEach(add::accept);
	}

	@Override
	public void close() {}

}
